<template>
  <div>
   
      <f-search-form :more="true" @searchHandler="searchHandler" :tableObj="tableObj" :show-export-btn='true' export-url='exportUrl2'>
        <f-search-form-item label="部门名称" ref="dept"  name="deptId" type="select"   valueKey="deptId" label-key="deptName" style="width:220px"/>
        <f-search-form-item label="订单编号" name="orderNo" style="width: 250px"/>
        <f-search-form-item label="回款日期" name="orderNo" style="width: 250px"/>
      </f-search-form>
      <f-table ref="table"  rowKey="orderDetailsId" :showSetting="true"  :tableColumns="columns" :scroll="{x:true}"  :multiple="false" :operator="operator" :params="queryParam" :api="api.bod" handler="orderDetailsReportHandler">
      </f-table>
      <order-info-drawer ref="orderInfoDrawer"></order-info-drawer>
    
  </div>
</template>
<script>
  import api from '../../js/api'
  import OrderInfoDrawer from '@/views/module/business/order/order_info_drawer'

  export default {
    name: 'ProfitTab2',
    components: {
      OrderInfoDrawer
    },
    data() {
      let me = this
      //操作按钮
      let operator = []
      let customFlag=this.$store.state.user.customFlag
      return {
        api: Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {
          companyId:this.$store.state.user.companyId
        },
        tableObj:null,
        superAdmin: this.superAdmin,
        // 表头
        columns: [
          {
            title: '序号',
            width: '70px',
            align: 'center',
            fixed: 'left',
            customRender: (text, record, index) => index + 1
          },
          {
            title: '商务部',
            align: 'left',
            width: '130px',
            dataIndex: 'orderNo',
            scopedSlots: { customRender: 'orderNo' }
          },
          {
            title: '负责人',
            align: 'left',
            width: '130px',
            dataIndex: 'orderNo',
            scopedSlots: { customRender: 'orderNo' }
          },
          {
            title: '2023-01',
            align: 'center',
            children:[
              {
                title: '月度分红',
                dataIndex: 'building',
                key: 'building',
                width: 100,
              },{
                title: '利润总额',
                dataIndex: 'building',
                key: 'building',
                width: 100,
              },{
                title: '费用',
                dataIndex: 'building',
                key: 'building',
                width: 100,
              },{
                title: '利润结余',
                dataIndex: 'building',
                key: 'building',
                width: 100,
              },{
                title: '团建费',
                dataIndex: 'building',
                key: 'building',
                width: 100,
              },{
                title: '实发薪资',
                dataIndex: 'building',
                key: 'building',
                width: 100,
              },
            ]
          },
          {
            title: '2023-02',
            align: 'center',
            children:[
              {
                title: '月度分红',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '利润总额',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '费用',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '利润结余',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '团建费',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '实发薪资',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },
            ]
          },
          {
            title: '2023-03',
            align: 'center',
            children:[
              {
                title: '月度分红',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '利润总额',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '费用',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '利润结余',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '团建费',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },{
                title: '实发薪资',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },
            ]
          },
          {
            title: '大区年终分红(20%)',
            align: 'left',
            width: '130px',
            dataIndex: 'orderNo',
            scopedSlots: { customRender: 'orderNo' }
          },
          {
            title: '商务中心总监',
            align: 'center',
            width: '130px',
            children:[
              {
                title: '商务中心总监指定分配20%',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },
              {
                title: '部门总监月度分红挂账10%',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              }
            ]
          },
          {
            title: '商务中心团建',
            align: 'center',
            width: '130px',
            children:[
              {
                title: '部门总监年终分红（需考核）20%',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              },
              {
                title: '团建10%',
                dataIndex: 'building',
                key: 'building',
                width: 80,
              }
            ]
          },
          {
            title: '公司服务团队（总经理指定分配）20%',
            align: 'center',
            width: '130px',
            dataIndex: 'orderNo',
            scopedSlots: { customRender: 'orderNo' }
          },
        ],
        operator: operator
      }
    },
    created() {
    },
    mounted() {
      this.tableObj=this.$refs.table
    },
    methods: {
      onCopy() {
        this.$message.success('复制成功!')
      },
      initSettle(record){
        this.http.confirm(this, {
          content: '确认初始化结算吗?',
          url: api.payment.initSettlePayment,
          data: {
            orderDetailsId: record.orderDetailsId
          }
        })
      },
      clearExport(){
        this.http.post(this, {
          url: this.api.bod.clearExportData
        })
      }
    }
  }
</script>
